package com.java.frontweb.controller;

import com.java.frontweb.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * @ClassName IndexController
 * @Description 首页
 * @Author Trigger Wu
 * @Date 2018/9/1416:17
 * @Version 1.0
 **/
@Controller
@RequestMapping("/rest/index")
public class IndexController {
    @Autowired
    private IndexService indexService;

    /**
     * 首页
     *
     * @return
     */
    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView index() {
        ModelAndView mv = new ModelAndView("index");
        // 首页大广告
        String indexAD1 = indexService.queryIndexAD1();
        mv.addObject("indexAD1", indexAD1);
        // 首页小广告
        String indexAD2 = indexService.queryIndexAD2();
        mv.addObject("indexAD2", indexAD2);
        return mv;
    }
}
